package com.nf.health.app.activity.my.bean;

import com.nf.health.app.models.BaseModel;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/3/30/030.
 */

public class QuestionResultModel implements BaseModel {
    /**
     * score : 20
     * list : [{"id":3,"title":"肌肉丰满，皮肤有弹性。","correct":"优","answer":"优,良,差","choose":"良"},{"id":4,"title":"睡眠基本正常","correct":"优","answer":"优,良,差","choose":"差"},{"id":5,"title":"食欲和消化功能基本正常","correct":"优","answer":"优,良,差","choose":"差"},{"id":6,"title":"注意力，记忆力，思考能力基本正常","correct":"优","answer":"优,良,差","choose":"良"}]
     */

    private String score;
    private List<ListBean> list;
    public List<QuestionResultModel.ListBean>    parse2(List<QuestionResultModel.ListBean>  list) {
        List<QuestionResultModel.ListBean> result = new ArrayList<>();
        if(list == null){
            return  result;
        }
        for (int i = 0; i < list.size(); i++) {
            QuestionResultModel.ListBean listBean= list.get(i);
            String answer =listBean.getAnswer();
            Map<Integer, String> hashMap = new HashMap<>();
            try {
                String [] answerArray = answer.split(",");
                for (int j = 0; j < answerArray.length; j++) {
                    hashMap.put(j,answerArray[j]);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
            listBean.setHashMap(hashMap);
            result.add(listBean);
        }
        return result;
    }
    /*public String getMyList(){

    }*/
    @Override
    public void parse(String jsonString) {

    }

    public String getScore() {
        return score;
    }

    public void setScore(String score) {
        this.score = score;
    }

    public List<ListBean> getList() {
        return list;
    }

    public void setList(List<ListBean> list) {
        this.list = list;
    }


    public static class ListBean {
        /**
         * id : 3
         * title : 肌肉丰满，皮肤有弹性。
         * correct : 优
         * answer : 优,良,差
         * choose : 良
         */

        private int id;
        private String title;
        private String correct;
        private String answer;
        private String choose;
        private Map<Integer, String> hashMap;
        private String type ="";

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public Map<Integer, String> getHashMap() {
            return hashMap;
        }

        public void setHashMap(Map<Integer, String> hashMap) {
            this.hashMap = hashMap;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getCorrect() {
            return correct;
        }

        public void setCorrect(String correct) {
            this.correct = correct;
        }

        public String getAnswer() {
            return answer;
        }

        public void setAnswer(String answer) {
            this.answer = answer;
        }

        public String getChoose() {
            return choose;
        }

        public void setChoose(String choose) {
            this.choose = choose;
        }
    }
}
